package test1231;

public class CC {
    String name;
    EE[]arr=new EE[10];
    int i =0;

    public CC() {
    }

    public CC(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "CC{" +
                "name='" + name + '\'' +
                '}';
    }
    public void add(EE ee) {
        arr[i]=ee;
        i++;

    }

    //考点 重载
    public void add(String name,int age,int salary){
        arr[i]=new EE(name,age,salary);
        i++;
    }

    public void printAll() {
        for(EE e : arr) {
            System.out.println(e);
        }
    }

    public EE m1() {
        EE x=arr[0];
        for (EE e:arr){
            if(e.getAge()<x.getAge()){
                x=e;
            }
        }
        return x;
    }

    public EE m2() {
        EE x=arr[0];
        for (EE e:arr){
            if(e.getSalary()>x.getSalary()){
                x=e;
            }
        }
        return x;
    }

    public EE m3(String 李四) {
        EE x= null;
        for (EE e:arr){
            if (e.getName()==name){
                x=e;
            }
        }
        return x;
    }

    public double m4() {
        double sum=0;
        for(EE e:arr){
            sum =e.getSalary();

        }
        return sum;

    }
}
